package com.linkq.ipinyin.controller;

import com.linkq.ipinyin.model.CnCharacter;
import com.linkq.ipinyin.service.CnCharacterService;
import com.linkq.ipinyin.vo.ResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @FileName BcChCharacterControoler
 * @Description
 * @Author wangpeng
 * @date 2024-12-30
 **/

@RestController
@RequestMapping("character")
public class CnCharacterController {

    @Autowired
    private CnCharacterService cnCharacterService;

    @PostMapping("add")
    public ResultInfo add(@RequestBody CnCharacter cnCharacter) {
        return cnCharacterService.add(cnCharacter);
    }

    @PostMapping("list")
    public ResultInfo list(@RequestBody CnCharacter cnCharacter) {
        return ResultInfo.success(cnCharacterService.getCharacterList(cnCharacter));
    }

    @PostMapping("delete")
    public ResultInfo delete(@RequestBody List<Integer> ids) {
        return cnCharacterService.delete(ids);
    }

    @PostMapping("edit")
    public ResultInfo edit(@RequestBody CnCharacter cnCharacter) {
        return cnCharacterService.edit(cnCharacter);
    }
}
